const baseUrl = `http://8.130.99.108:8090`;

export function get(params, url) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: `${baseUrl}${url}`, //仅为示例，并非真实的接口地址
      data: {
        ...params,
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded', // 默认值
      },
      method: 'GET',
      success: (res) => {
        resolve(res);
      },
      fail: (error) => {
        reject(error);
      },
    });
  });
}

export function post(params, url) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: `${baseUrl}${url}`, //仅为示例，并非真实的接口地址
      data: {
        ...params,
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded', // 默认值
      },
      method: 'GET',
      success: (res) => {
        resolve(res);
      },
      fail: (error) => {
        reject(error);
      },
    });
  });
}
